package com.j.lemon.learn.thread.ThreadControl;

/**
 * @Author lijunjun
 * @Date 2019-04-02 11:22
 * @Description
 */
public class Join {
    public static void main(String[] args) throws InterruptedException {

        Thread t1 = new Thread(()->{
            for (int i = 0; i < 10; i++) {
                System.out.println("图片已下载"+(i+1)*10+"%");
            }
            System.out.println("图片下载完成");

        });

        Thread t2 = new Thread(()->{
            System.out.println("收到请求开始展示图片");
            System.out.println("开始下载图片");
            try {
                t1.join();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println("展示图片成功");
        });

        t1.start();
        Thread.sleep(1000);
        t2.start();
    }
}
